# 杨辉三角2.0
l = []
for x in range(9):
    if x == 0:
        l.append([1])
    elif x == 1:
        l.append([1,1])
    else:
        a = []
        for y in range(len(l[x-1])):
            if y == 0:
                a.append(1)
            else:
                a.append(l[x-1][y-1]+l[x-1][y])
        a.append(1)
        l.append(a)
# 打印
for x in l:
    res = ""
    for y in x:
        res += (str(y) + "  ")
    print(res.center(60))#返回一个居中的字符串，cente（宽度）

